<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<%@ attribute name="name" required="true" rtexprvalue="true" description="name of text element"%>
<%@ attribute name="label" required="false" rtexprvalue="true" description="Label of text element"%>
<%@ attribute name="bindPath" required="true" rtexprvalue="true" description="Bind path of text element"%>
<%@ attribute name="widgetType" required="false" rtexprvalue="true" description="WidgetType of text element"%>
<%@ attribute name="id" required="false" rtexprvalue="true" description="ID of text input element"%>
<%@ attribute name="widgetAttrs" required="false" rtexprvalue="true" description="WidgetAttrs of text element"%>
<%@ attribute name="cssStyle" required="false" rtexprvalue="true" description="CSS Style of text element"%>
<%@ attribute name="cssLabelStyle" required="false" rtexprvalue="true" description="CSS Style of label grid"%>
<%@ attribute name="cssElementlStyle" required="false" rtexprvalue="true" description="CSS Style of element grid"%>
<%@ attribute name="hiddenLabel" required="false" rtexprvalue="true" description="Hidden Label" type="java.lang.Boolean"%>

<c:choose>
	<c:when test="${label == null || label == ''}">
		<c:set var="label" value="${name}" />
	</c:when>
</c:choose>
<c:choose>
  <c:when test="${id == null || id == ''}">
    <c:set var="id" value="${name}" />
  </c:when>
</c:choose>
<c:choose>
  <c:when test="${widgetType == null || widgetType == ''}">
    <c:set var="widgetType" value="dijit.form.Textarea" />
  </c:when>
</c:choose>

<c:if test="${!hiddenLabel}">
	<li class="form_grid_label" style="${cssLabelStyle}"><label for="${name}">${label}:</label></li>
	<li class="form_grid_element" style="${cssElementlStyle}">
</c:if>	
	<form:textarea id="${id}" path="${bindPath}" cssStyle="${cssStyle}"/> <script type="text/javascript">
		Spring.addDecoration(new Spring.ElementDecoration({
			elementId : "${id}",
			widgetType : "${widgetType}"
			<c:if test="${widgetAttrs != null}">,widgetAttrs : {${widgetAttrs}}</c:if>
		}));
	</script>
<c:if test="${!hiddenLabel}">
	</li>
</c:if>